<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<List<mesoBoard.Services.SearchResult>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">

    <% using(Html.BeginForm()){ %>
        <fieldset>
            <legend><%= Html.ThemeImage("find.png") %> Search</legend>
            
            <dl class="form">
                <dt>Keywords</dt>
                <dd><%= Html.TextBox("Keywords", "", new { style="width: 300px" })%></dd>
                
                <dt>&nbsp;</dt>
                <dd>
                    <%= Html.SubmitButton("Search", "Search") %>
                </dd>
                
            </dl>
            
        </fieldset>
    <%} %>

    <% if (Model != null){%>
        
        <fieldset>
            <legend>Search Results</legend>
            
            <%
           int i = 0;
           foreach (var s in Model){ %>           
           <div class="search_result <%= i++ % 2 == 0 ? "alt_post" : "" %>">
               <b><a href="<%= Url.Action("ViewThread", "Board", new { ThreadID = s.ThreadID, PostID = s.PostID })  %>#<%= s.PostID %>"><%= s.ThreadTitle %></a></b>
               <br />
               <%= s.Text.Shorten(300) %>
           </div>
           <%= Html.Spacer(3) %>
           <% }
           if (Model.Count == 0) { %>
               <div>
                    No search results found, please choose better keywords
               </div>
           <%}
           else{ %>
            <% Html.RenderPartial("Paging", ViewData["Paging"]); %>
           <% } %>
            
        </fieldset>       
    <% } %>
</asp:Content>
